<?
import("jsml_Bean");
import("jsml_View");
class jsml_Config{
	//public static $config;

	protected $beanMap = array("__new__"=>1);

	protected function configBean($key) {
		$bean = null;
		if ("" == $key) {
		}
		return $bean;
	}

	protected function configCss($key) {
		$css = array(
			"position" => "absolute",
		//"overflow" => "hidden",
			"left" => "0px",
			"top" => "0px",
			"width" => "0px",
			"height" => "0px"
			//"border-width" => 0
		);
		if (null == $key) {
		}
		return $css;
	}

	protected function configText($key) {
		$text = "";
		if ("" == $key) {
		}
		return $text;
	}

	public function getBean($key) {
		$bean = $this->beanMap[$key];
		if ($bean == null) {
			$bean = $this->configBean($key);
		}
		return $bean;
	}

	public function getCss($key, $cssExtra) {
		$css = $this->configCss($key);
		if($cssExtra != null) $_->extend($css, $cssExtra);
		return $css;
	}

	public function getCssString($key, $cssExtra) {
		$css = $this->configCss($key);
		if($cssExtra != null) $_->extend($css, $cssExtra);
		$cssString = array();
		foreach($css as $key=>$value){
			array_push($cssString, $key, ":", $value, ";");
		}
		return implode("", $cssString);
	}

	public function getText($key) {
		return $this->configText($key);
	}

	protected function prototype($key, $bean) {
		$bean->config = $this;
		return $bean;
	}

	protected function singleton($key, $bean) {
		$bean->config = $this;
		$this->beanMap[$key] = $bean;
		return $bean;
	}
}